#ifndef __BSP_SPI_H_
#define __BSP_SPI_H_

#include <stdint.h>
#include <stdbool.h>

#include "at32f403a_407.h"
#include "at32project_header.h"


#define SPI_TRANS_DMA

int bsp_spi1_init(void);
void bsp_spi1_bytes_write(uint8_t *pbuffer, uint32_t length);
void bsp_spi1_bytes_read(uint8_t *pbuffer, uint32_t length);
int bsp_spi1_bytes_write_read(uint8_t *txdata,uint8_t *rxdata, uint32_t length);


int bsp_spi2_init(void);
void bsp_spi2_bytes_write(uint8_t *pbuffer, uint32_t length);
void bsp_spi2_bytes_read(uint8_t *pbuffer, uint32_t length);
void bsp_spi2_bytes_write_read(uint8_t *txdata,uint8_t *rxdata, uint32_t length);

#endif

